
import Vue from "vue";
import App from "./App.vue";
import Vuex from "vuex";
import router from "./router";
import store from '@/store'

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";

import VScrollLock from 'v-scroll-lock'
Vue.use(VScrollLock)

//import http from "axios";

import axios from "axios";

Vue.config.productionTip = false;

ElementUI.Dialog.props.closeOnClickModal.default=false
Vue.use(ElementUI);
Vue.use(Vuex);

//**
//Vue.prototype.$http = http;
//Vue.prototype.global = global;

Vue.prototype.$reset = function (formRef, ...excludeFields) {//弹窗关闭清空
  this.$refs[formRef].resetFields();
  console.log('清空',formRef)

};

Vue.prototype.$resetSetItem = function (key, newVal) {
   if (key === 'username') {


       var newStorageEvent = document.createEvent('StorageEvent');
       const storage = {
           setItem: function (k, val) {
                //sessionStorage.setItem(k, val);

               // 初始化创建的事件
               newStorageEvent.initStorageEvent('setItem', false, false, k, null, val, null, null);

                // 派发对象
                window.dispatchEvent(newStorageEvent)
            }
        }
        return storage.setItem(key, newVal);
     }
  else if(key==='clear'){
    var newStorageEvent = document.createEvent('StorageEvent');
       const storage = {
           clear: function (k, val) {
                //sessionStorage.setItem(k, val);

               // 初始化创建的事件
               newStorageEvent.initStorageEvent('clear', false, false, k, null, val, null, null);

                // 派发对象
                window.dispatchEvent(newStorageEvent)
            }
        }
        return storage.clear(key, newVal);
  }
}
new Vue({
    store,
    router,
    axios,
    render: h => h(App),
}).$mount('#app')



// import Vue from 'vue'
// import Vuex from "vuex";
// import App from './App.vue'
// import router from "./router";
// import ElementUI from 'element-ui';
// import 'element-ui/lib/theme-chalk/index.css';
// import axios from "axios";
// import store from '@/store'
// import VScrollLock from 'v-scroll-lock'
//
//
// Vue.use(ElementUI);
// Vue.use(VScrollLock)
// Vue.use(Vuex)
//
// //import axios from "axios";
//
// ElementUI.Dialog.props.closeOnClickModal.default=false
//
// Vue.config.productionTip = false
// Vue.prototype.$baseUrl = process.env["VUE_APP_BASEURL"]
//
//
// Vue.prototype.$resetSetItem = function (key, newVal) {
//     if (key === 'username') {
//
//
//         var newStorageEvent = document.createEvent('StorageEvent');
//         const storage = {
//             setItem: function (k, val) {
//                 //sessionStorage.setItem(k, val);
//
//                 // 初始化创建的事件
//                 newStorageEvent.initStorageEvent('setItem', false, false, k, null, val, null, null);
//
//                 // 派发对象
//                 window.dispatchEvent(newStorageEvent)
//             }
//         }
//         return storage.setItem(key, newVal);
//     }
//     else if(key==='clear'){
//         var newStorageEvent = document.createEvent('StorageEvent');
//         const storage = {
//             clear: function (k, val) {
//                 //sessionStorage.setItem(k, val);
//
//                 // 初始化创建的事件
//                 newStorageEvent.initStorageEvent('clear', false, false, k, null, val, null, null);
//
//                 // 派发对象
//                 window.dispatchEvent(newStorageEvent)
//             }
//         }
//         return storage.clear(key, newVal);
//     }
// }
//
// new Vue({
//     router,
//     axios,
//     store,
//     render: h => h(App),
// }).$mount('#app')
